<template>
  <base-dialog title="邮件日志详情" ref="baseDialog" :btnShow="false" width="42%">
    <el-form ref="form" disabled :model="form" label-width="125px" size="mini">
      <el-row>
        <el-col :span="24">
          <el-form-item label="日志主键：">{{ form.id }}</el-form-item>
        </el-col>
        <el-col :span="24">
          <el-form-item label="短信渠道：">
            {{ form.channelId }}
          </el-form-item>
        </el-col>
        <el-col :span="24">
          <el-form-item label="短信模板：">
            {{ form.templateId }} | {{ form.templateCode }}
          </el-form-item>
        </el-col>
        <el-col :span="24">
          <el-form-item label="API 的模板编号：">{{ form.apiTemplateId }}</el-form-item>
        </el-col>
        <el-col :span="24">
          <el-form-item label="用户信息：">
            {{ form.mobile }}
            <span v-if="form.userType && form.userId">
              <!-- <dict-tag :type="DICT_TYPE.USER_TYPE" :value="form.userType" /> -->
              ({{ form.userType }}) | ({{ form.userId }})
            </span>
          </el-form-item>
        </el-col>
        <el-col :span="24">
          <el-form-item label="短信内容：">{{ form.templateContent }}</el-form-item>
        </el-col>
        <el-col :span="24">
          <el-form-item label="短信参数：">{{ form.templateParams }}</el-form-item>
        </el-col>
        <el-col :span="24">
          <el-form-item label="创建时间：">{{ form.createTime }}</el-form-item>
        </el-col>
        <el-col :span="24">
          <el-form-item label="发送状态：">{{ form.sendStatus }}</el-form-item>
        </el-col>
        <el-col :span="24">
          <el-form-item label="发送时间：">{{ form.sendTime }}</el-form-item>
        </el-col>
        <el-col :span="24">
          <el-form-item label="发送结果：">{{ form.sendCode }} | {{ form.sendMsg }}</el-form-item>
        </el-col>
        <el-col :span="24">
          <el-form-item label="API 发送结果：">
            {{ form.apiSendCode }} | {{ form.apiSendMsg }}
          </el-form-item>
        </el-col>
        <el-col :span="24">
          <el-form-item label="API 短信编号：">{{ form.apiSerialNo }}</el-form-item>
        </el-col>
        <el-col :span="24">
          <el-form-item label="API 请求编号：">{{ form.apiRequestId }}</el-form-item>
        </el-col>
        <el-col :span="24">
          <el-form-item label="接收状态：">
            {{ form.receiveStatus }}
          </el-form-item>
        </el-col>
        <el-col :span="24">
          <el-form-item label="接收时间：">{{ form.receiveTime }}</el-form-item>
        </el-col>
        <el-col :span="24">
          <el-form-item label="API 接收结果：">
            {{ form.apiReceiveCode }} | {{ form.apiReceiveMsg }}
          </el-form-item>
        </el-col>
      </el-row>
    </el-form>
  </base-dialog>
</template>

<script>
export default {
  name: "Dialog",
  props: {
    typeList: {
      default: () => [],
      type: Array
    },
    channelList: {
      default: () => [],
      type: Array
    },
    sendStatusList: {
      default: () => [],
      type: Array
    },
    receiveStatusList: {
      default: () => [],
      type: Array
    }
  },
  data() {
    return {
      form: {}
    }
  },
  methods: {
    init(item) {
      this.$refs.baseDialog.dialogVisible = true
      if (item) {
        this.form = JSON.parse(JSON.stringify(item))
        this.form.sendStatus = this.sendStatusList.find(
          (item) => item.value == this.form.sendStatus
        )?.label
        this.form.receiveStatus = this.receiveStatusList.find(
          (item) => item.value == this.form.receiveStatus
        )?.label
        this.form.channelId = this.channelList.find(
          (item) => item.id == this.form.channelId
        )?.signature
        // this.form.templateType = this.typeList.find(
        //   (item) => item.value == this.form.templateType
        // )?.label
      }
    },
    handleClose() {
      this.$refs.baseDialog.dialogVisible = false
      this.title = ""
    }
  }
}
</script>

<style lang="scss" scoped>
.el-select,
.picker,
.el-input-number {
  width: 100%;
}
</style>
